/**
  ******************************************************************************
  * @author     Chris
  * @since      2024/6/28 15:40
  *
  * @file       pd_iwdg.h
  * @brief      Header file of Xxx hardware driver.
  *
  * @note       This file contains the Xxx object declaration.
  *
  * @warning    None.
  ******************************************************************************
  * Change Logs:
  *   Date          Author       Notes
  *   2024/6/28     Chris        the first version
  *
  ******************************************************************************
  */


#ifndef JLC_SKY_IWDG_H
#define JLC_SKY_IWDG_H

#include "pd_wdg.h"

struct IndepWDGVtbl;

/** @defgroup Object properties
  * @{
  */
typedef struct {
    WDG wdg;

    IWDG_TypeDef *IWDGx;
    uint32_t Prescaler;
    uint32_t milliseconds;  // max feed dogs time

    // IndepWDG virtual table
    struct IndepWDGVtbl *vptr;
} IndepWDG; /* extends from {@see WDG} */
/**
 * @}
 */

/** @defgroup Object virtual table definition
  * @{
  */
struct IndepWDGVtbl {
    void (*init)(const IndepWDG *this);

};
/**
 * @}
 */

/** @defgroup Object constructor and member function declaration
  * @{
  */
void IndepWDG_constructor(IndepWDG *this, IWDG_TypeDef *IWDGx, uint32_t Prescaler, uint32_t milliseconds);
/**
 * @}
 */

/** @defgroup Object virtual table function implementation
  * @{
  */
static inline void IndepWDG_init(const IndepWDG *this) {
    this->vptr->init(this);
}
/**
 * @}
 */


#endif //JLC_SKY_IWDG_H
